import org.apache.spark.{SparkConf, SparkContext}

object cillect{
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("Example").setMaster("local")
    val sc = new SparkContext(conf)

    val test = sc.parallelize(List("How are you", "I am fine", "What about you"))


    val test_collect = test.collect()
    println("test_collect: " + test_collect.mkString(", "))

    val test_map = test.map(x => x.split(" "))
    val test_map_collect = test_map.collect()
    println("test_map_collect: " + test_map_collect.deep.mkString(", "))


    val test_flatMap = test.flatMap(x => x.split(" "))
    val test_flatMap_collect = test_flatMap.collect()
    println("test_flatMap_collect: " + test_flatMap_collect.mkString(", "))
  }
}